package com.campus.campus.corn;

import com.campus.campus.service.IUtilityBillsService;
import com.campus.campus.service.IStaticDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class ScheduledTasks {

    @Autowired
    private IUtilityBillsService utilityBillsService;

    @Autowired
    private IStaticDataService staticDataService;

    @Scheduled(cron = "0 0/60 * * * ?") // 每隔 20 分钟运行一次
    public void doTask() {
        utilityBillsService.subtratElectronicFee();
        utilityBillsService.subtratWaterFee();
    }

        @Scheduled(cron = "0 30 23 * * ?") // 每天 23:30 执行一次
//    @Scheduled(cron = "0 0/2 * * * ?") // 每隔 20 分钟运行一次
    public void doTaskOne() {
        staticDataService.insertData();
    }


}
